﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace SMP.Service
{
    using SMP.Resource;
    using SMP.Domain;
    using System.Data;
    
    public class Mathang_Service
    {
        Nhom_Mathang_Res _objNhom_Mathang = new Nhom_Mathang_Res();
        Mathang_Res _objMathang = new Mathang_Res();
        Donvi_Tinh_Res _objDonvi_Tinh = new Donvi_Tinh_Res();

        #region Nhóm mặt hàng

        public DataTable GetAll_Nhom_Mathang()
        {
            return _objNhom_Mathang.GetAll_Nhom_Mathang();
        }

        public bool Get_Mathang_Check_Used_By_Id_Nhom_Mathang(object id_nhom_mathang)
        {
            var dtb = _objNhom_Mathang.Get_Mathang_Check_Used_By_Id_Nhom_Mathang(Convert.ToInt64("0" + id_nhom_mathang));
            if (dtb.Rows.Count > 0)
                return true;
            return false;
        }

        public bool Delete_Nhom_Mathang(object id_nhom_mathang)
        {
            return _objNhom_Mathang.Delete_Nhom_Mathang(Convert.ToInt64("0" + id_nhom_mathang));
        }

        public bool Insert_Nhom_Mathang(Nhom_Mathang nhom_mathang)
        {
            return _objNhom_Mathang.Insert_Nhom_Mathang(nhom_mathang);
        }

        public bool Update_Nhom_Mathang(Nhom_Mathang nhom_mathang)
        {
            return _objNhom_Mathang.Update_Nhom_Mathang(nhom_mathang);
        }

        #endregion#


        #region Mặt hàng

        public DataTable GetAll_Mathang()
        {
            return _objMathang.GetAll_Mathang();
        }

        public DataTable GetAll_Mathang_Xuatkho()
        {
            return _objMathang.GetAll_Mathang_Xuatkho();
        }

        public bool Get_Mathang_Check_Used_By_Id_Mathang(object id_mathang)
        {
            var dtb = _objMathang.Get_Mathang_Check_Used_By_Id_Mathang(Convert.ToInt64("0" + id_mathang));
            if (dtb.Rows.Count > 0)
                return true;
            return false;
        }

        public bool Delete_Mathang(object id_mathang)
        {
            return _objMathang.Delete_Mathang(Convert.ToInt64("0" + id_mathang));
        }

        public bool Insert_Mathang(Mathang mathang)
        {
            return _objMathang.Insert_Mathang(mathang);
        }

        public bool Update_Mathang(Mathang mathang)
        {
            return _objMathang.Update_Mathang(mathang);
        }


        #endregion#


        #region Đơn vị tính

        public DataTable GetAll_Donvi_Tinh()
        {
            return _objDonvi_Tinh.GetAll_Donvi_Tinh();
        }

        public bool Get_Mathang_Check_Used_By_Id_Donvi_Tinh(object id_donvi_tinh)
        {
            var dtb = _objDonvi_Tinh.Get_Mathang_Check_Used_By_Id_Donvi_Tinh(Convert.ToInt64("0" + id_donvi_tinh));
            if (dtb.Rows.Count > 0)
                return true;
            return false;
        }

        public bool Delete_Donvi_Tinh(object id_donvi_tinh)
        {
            return _objDonvi_Tinh.Delete_Donvi_Tinh(Convert.ToInt64("0" + id_donvi_tinh));
        }

        public bool Insert_Donvi_Tinh(Donvi_Tinh donvi_tinh)
        {
            return _objDonvi_Tinh.Insert_Donvi_Tinh(donvi_tinh);
        }

        public bool Update_Donvi_Tinh(Donvi_Tinh donvi_tinh)
        {
            return _objDonvi_Tinh.Update_Donvi_Tinh(donvi_tinh);
        }


        #endregion#













    }
}
